package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 家族史表
 * @author jing
 *
 */
@JsonApiResource(type = "familyhistory")
@Table(name = "tnb_family_history")
@Entity
public class FamilyHistory extends BaseEntity {

	private Dicttype homeHistoryType ;   //对应的家族史的遗传病
	
	private Dicttype homeManType ; //对应的家族成员
	
	private HealthRecord healthrecord; //对应的健康档案表
	
	private String remark; //备注


	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "health_record_id", foreignKey = @ForeignKey(name = "null"))
	public HealthRecord getHealthrecord() {
		return healthrecord;
	}   

	public void setHealthrecord(HealthRecord healthrecord) {
		this.healthrecord = healthrecord;
	} 

	@Column(name="remark")
	public String getRemark() {
		return remark;
	}  

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name ="homeHistoryType_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getHomeHistoryType() {
		return homeHistoryType;
	}

	public void setHomeHistoryType(Dicttype homeHistoryType) {
		this.homeHistoryType = homeHistoryType;
	}  

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name ="homeMan_type_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getHomeManType() {
		return homeManType;
	}

	public void setHomeManType(Dicttype homeManType) {
		this.homeManType = homeManType;
	}	
	

}